local fengzi = fk.CreateSkill {
  name = "fengzi",
}

fengzi:addEffect(fk.CardUsing, {
  anim_type = "control",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(self) and player.phase == Player.Play and
      (data.card.type == Card.TypeBasic or data.card:isCommonTrick()) and data.tos and
      player:usedSkillTimes(self.name, Player.HistoryPhase) == 0 and not player:isKongcheng()
  end,
  on_cost = function(self, event, target, player, data)
    local type = data.card:getTypeString()
    local card = player.room:askToDiscard(player,{min_num=1,max_num=1,include_equip=false,skill_name=self.name,cancelable=true,pattern=".|.|.|.|.|"..type
    ,prompt="#fengzi-invoke:::"..type..":"..data.card:toLogString(),skip=true})
    if #card > 0 then
      event:setCostData(self,{cards = card})
      return true
    end
  end,
  on_use = function(self, event, target, player, data)
    player.room:throwCard(event:getCostData(self).cards, self.name, player, player)
    data.additionalEffect = (data.additionalEffect or 0) + 1
  end,
})

return fengzi